home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / STRINGS / TPSTR7 / EXAM23.PAS < prev    next >
Pascal/Delphi Source File  |  1993-03-14  |  5KB  |  104 lines

  1. Program Exam23;
  2.  
  3. {**************************************************************************}
  4. {                                                                          }
  5. { Ce programme démontre les possibilités StrDeTab? et StrReTab?.           }
  6. {                                                                          }
  7. {**************************************************************************}
  8.  
  9. Uses
  10.   TpStr;
  11.  
  12. Var
  13.   S1  ,
  14.   S2  : String;
  15.  
  16. {  ---------------------------------------------------------------         }
  17. {  Procedure   StrDeTab(Var Str1: String;Str2:String;TabSize: Byte);       }
  18. {  ---------------------------------------------------------------         }
  19. {                                                                          }
  20. {  Effet     : Crée <Str1> à partir de <Str2> en remplacant tout les       }
  21. {              caractères de tabulation par <TabSize> espaces.             }
  22. {                                                                          }
  23. {  Usage     : Chaîne pascal.                                              }
  24. {                                                                          }
  25. {  Vitesse   : 7800/s                                                      }
  26. {                                                                          }
  27. { -------------------------------------------------------------------------}
  28.  
  29. Procedure Test1;
  30. Begin
  31.   S1  := 'abcde'#9'fghij'#9'klmno'#9'pqrst'#9'uvwxyz';
  32.   StrDeTab(S2,S1,5);
  33.   StrDeTab(S2,S1,10);
  34. end;
  35.  
  36. {  ---------------------------------------------------------------         }
  37. {  Functionn    StrDeTab_(Str1: String;TabSize: Byte):String;              }
  38. {  ---------------------------------------------------------------         }
  39. {                                                                          }
  40. {  Effet     : Idem.                                                       }
  41. {                                                                          }
  42. {  Usage     : Chaîne pascal.                                              }
  43. {                                                                          }
  44. {  Vitesse   : 7800/s                                                      }
  45. {                                                                          }
  46. {  Note      : transformée en fonction.                                    }
  47. { -------------------------------------------------------------------------}
  48.  
  49. Procedure Test2;
  50. Begin
  51.   S1  := 'abcde'#9'fghij'#9'klmno'#9'pqrst'#9'uvwxyz';
  52.   S2 := StrDeTab_(S1,5);
  53.   S2 := StrDeTab_(S1,10);
  54. end;
  55.  
  56. {  ---------------------------------------------------------------         }
  57. {  Procedure  StrReTab(Var Str1: String;Str2: String;TabSize: Byte);       }
  58. {  ---------------------------------------------------------------         }
  59. {                                                                          }
  60. {  Effet     : Fonction inverse de la précédente: <Str1> est crée à partir }
  61. {              de la chaîne <Str2> en remplacant tous les <TabSize> espaces}
  62. {              consécutifs par un caractère de tabulation.                 }
  63. {                                                                          }
  64. {  Usage     : Chaîne pascal.                                              }
  65. {                                                                          }
  66. {  Vitesse   : 7800/s                                                      }
  67. {                                                                          }
  68. { -------------------------------------------------------------------------}
  69.  
  70. Procedure Test3;
  71. Begin
  72.   S1  := 'Turbo     Pascal   est   un     produit   génial   ';
  73.   StrReTab(S2,S1,3);
  74.   StrRetab(S2,S1,5);
  75. end;
  76.  
  77. {  ---------------------------------------------------------------         }
  78. {  Function   StrReTab_(Str1: String;TabSize: Byte):String;                }
  79. {  ---------------------------------------------------------------         }
  80. {                                                                          }
  81. {  Effet     : Idem.                                                       }
  82. {                                                                          }
  83. {  Usage     : Chaîne pascal.                                              }
  84. {                                                                          }
  85. {  Vitesse   : 7800/s                                                      }
  86. {                                                                          }
  87. { -------------------------------------------------------------------------}
  88.  
  89. Procedure Test4;
  90. Begin
  91.   S1  := 'Turbo     Pascal   est   un     produit   génial   ';
  92.   S2 := StrReTab_(S1,3);
  93.   S2 := StrRetab_(S1,5);
  94. end;
  95.  
  96. Begin
  97.   Test1;
  98.   Test2;
  99.   Test3;
  100.   Test4;
  101. End.
  102.  
  103. { -------------------------------------------------------------------------}
  104.